package com.hmy.infrastructure.client.oss;

import com.hmy.ccp.common.result.FeignResult;
import com.hmy.ccp.common.result.Results;
import com.hmy.ccp.error.annotations.HmyFeignController;
import com.hmy.common.exception.ClientException;
import com.hmy.infrastructure.api.bo.response.oss.OssSignatureResponse;
import com.hmy.infrastructure.api.client.oss.OssClient;
import com.hmy.infrastructure.service.oss.OssStsService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;


@Api(tags = "OSS文件业务Client")
@Validated
@RestController("internalOssController")
@Slf4j
@HmyFeignController
public class OssClientController implements OssClient {

    @Resource
    private OssStsService ossStsService;


    @Override
    @GetMapping("/feign/oss/signature")
    public FeignResult<OssSignatureResponse> getSignature(@RequestParam(required = true) String dir) throws ClientException {
        return Results.newSuccessResult(ossStsService.getOssSignature(dir));
    }
}
